<html>
<head><meta charset="utf-8"><title>Project ideas · t-compiler/const-eval · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/index.html">t-compiler/const-eval</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html">Project ideas</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="183590338"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183590338" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183590338">(Dec 16 2019 at 21:04)</a>:</h4>
<p><span class="user-group-mention" data-user-group-id="1916">@WG-const-eval</span> Which CTFE-related features would you like to see worked on going forward? Here are a few off the top of my head.</p>
<ul>
<li><code>const</code> trait methods</li>
<li>anonymous <code>const</code> blocks</li>
<li><code>&amp;mut</code> in constants</li>
<li>heap allocation in constants</li>
<li>More precise analysis of<code>Drop</code>types in constants (<a href="https://github.com/rust-lang/rust/issues/66753" target="_blank" title="https://github.com/rust-lang/rust/issues/66753">#66753</a>)</li>
<li>Formal rules for promotion</li>
</ul>
<p>There's also some tasks that don't involve design work like:</p>
<ul>
<li>Addressing <a href="https://github.com/rust-lang/rust/issues/67191" target="_blank" title="https://github.com/rust-lang/rust/issues/67191">#67191</a></li>
<li>Improving Miri/CTFE performance</li>
</ul>
<p>It would be cool to know what people want to prioritize next year.</p>



<a name="183590406"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183590406" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183590406">(Dec 16 2019 at 21:05)</a>:</h4>
<p><span class="user-mention" data-user-id="132916">@Christian Poveda</span> is looking at mut references I believe</p>



<a name="183590439"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183590439" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183590439">(Dec 16 2019 at 21:05)</a>:</h4>
<p>I don't think we can even start on heap without at least an e-RFC</p>



<a name="183590507"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183590507" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183590507">(Dec 16 2019 at 21:06)</a>:</h4>
<blockquote>
<p><span class="user-mention silent" data-user-id="132916">Christian Poveda</span> is looking at mut references I believe</p>
</blockquote>
<p>yes we have a feature gate for that now</p>



<a name="183590525"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183590525" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183590525">(Dec 16 2019 at 21:06)</a>:</h4>
<p>True, <code>&amp;mut</code> is pretty close, although this is a bit concerning:</p>



<a name="183590532"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183590532" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183590532">(Dec 16 2019 at 21:07)</a>:</h4>
<p><a href="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=4371a0cf7245a7d235cb2b8809b0bb10" target="_blank" title="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=4371a0cf7245a7d235cb2b8809b0bb10">https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=4371a0cf7245a7d235cb2b8809b0bb10</a></p>



<a name="183590543"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183590543" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183590543">(Dec 16 2019 at 21:07)</a>:</h4>
<p>It's probably unsound, so I presume that's what <span class="user-mention" data-user-id="118594">@ecstatic-morse</span> means</p>



<a name="183590619"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183590619" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183590619">(Dec 16 2019 at 21:07)</a>:</h4>
<p>ROFL yea, constants are bad</p>



<a name="183590646"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183590646" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183590646">(Dec 16 2019 at 21:08)</a>:</h4>
<p>The others would all require RFCs, depending on how narrowly we want to address <a href="https://github.com/rust-lang/rust/issues/66753" target="_blank" title="https://github.com/rust-lang/rust/issues/66753">#66753</a></p>



<a name="183590709"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183590709" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183590709">(Dec 16 2019 at 21:08)</a>:</h4>
<p>Maybe we need <code>ConstSafe</code> even before heap</p>



<a name="183590863"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183590863" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183590863">(Dec 16 2019 at 21:08)</a>:</h4>
<p>But I recall that <code>const</code> trait methods have had a lot of design work and are  (maybe?) pretty close</p>



<a name="183591042"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183591042" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183591042">(Dec 16 2019 at 21:10)</a>:</h4>
<p>If I could pick one feature from the list above, it would probably be that one. Even though it's a ton of work and a pretty profound change to the language</p>



<a name="183591074"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183591074" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183591074">(Dec 16 2019 at 21:11)</a>:</h4>
<p>Yes, I have an RFC and the status is that T-lang discussed it and is basically fine with it being an experimental feature, but I'm waiting for public confirmation of this before doing any work on it. Otherwise an open PR would put pressure on the RFC being handled faster</p>



<a name="183591131"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183591131" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183591131">(Dec 16 2019 at 21:11)</a>:</h4>
<blockquote>
<p><a href="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=4371a0cf7245a7d235cb2b8809b0bb10" target="_blank" title="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=4371a0cf7245a7d235cb2b8809b0bb10">https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=4371a0cf7245a7d235cb2b8809b0bb10</a></p>
</blockquote>
<p>I'll take a look at this</p>



<a name="183591205"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183591205" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183591205">(Dec 16 2019 at 21:12)</a>:</h4>
<p>Maybe we could implement <code>?const Trait</code> first, because that is the behaviour of current trait bounds with <code>const_fn</code> enabled</p>



<a name="183591251"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183591251" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183591251">(Dec 16 2019 at 21:12)</a>:</h4>
<p><span class="user-mention" data-user-id="132916">@Christian Poveda</span> read the const heap tracking issue</p>



<a name="183591263"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183591263" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183591263">(Dec 16 2019 at 21:13)</a>:</h4>
<p>It has similar problems</p>



<a name="183591315"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183591315" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183591315">(Dec 16 2019 at 21:13)</a>:</h4>
<p>that's funny, I wanted to get involved with const heap :P</p>



<a name="183591495"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183591495" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183591495">(Dec 16 2019 at 21:15)</a>:</h4>
<p>There's no real difference between <code>Box&lt;T&gt;</code> and <code>&amp;mut T</code> if it's in a global thing</p>



<a name="183591524"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183591524" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183591524">(Dec 16 2019 at 21:15)</a>:</h4>
<p>I think the current RFC process is lacking when it comes to really big changes like <code>const</code> trait methods. It's better for small changes that don't need a lot of experimentation. The process laid out in <span class="user-mention silent" data-user-id="116009">nikomatsakis</span>' <a href="http://smallcultfollowing.com/babysteps/blog/2019/12/03/aic-improving-the-pre-rfc-process/" target="_blank" title="http://smallcultfollowing.com/babysteps/blog/2019/12/03/aic-improving-the-pre-rfc-process/">blog post</a> would be a much better fit.</p>



<a name="183591627"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183591627" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183591627">(Dec 16 2019 at 21:16)</a>:</h4>
<p>Ooh new RFC process blog posts. It's been a while</p>



<a name="183591865"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183591865" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183591865">(Dec 16 2019 at 21:18)</a>:</h4>
<p>Can anyone think of an obvious feature/work-item that I've missed?</p>



<a name="183591922"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183591922" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183591922">(Dec 16 2019 at 21:19)</a>:</h4>
<p>I guess there's always "pay down technical debt", which I've been doing a bit of in the const-checking arena.</p>



<a name="183592007"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183592007" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183592007">(Dec 16 2019 at 21:20)</a>:</h4>
<p>But that isn't very inspiring XD</p>



<a name="183592016"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183592016" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183592016">(Dec 16 2019 at 21:20)</a>:</h4>
<p>A bit is a bit of an understatement. That's some amazing cleanup duty you've taken up</p>



<a name="183592035"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183592035" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183592035">(Dec 16 2019 at 21:20)</a>:</h4>
<p>yeah code janitoring is underrated</p>



<a name="183592129"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183592129" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183592129">(Dec 16 2019 at 21:21)</a>:</h4>
<p>I'll think about what cool features are still missing in const eval. I think you covered the big ones. For now I'm going to bed. Oh one thought that I just had was side effects like emitting warnings on purpose or emitting artifacts.</p>



<a name="183592223"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183592223" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183592223">(Dec 16 2019 at 21:22)</a>:</h4>
<p>Also type declarations by const eval emitting a TyLayout equivalent</p>



<a name="183592248"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183592248" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183592248">(Dec 16 2019 at 21:22)</a>:</h4>
<p>So what proc macros did for codegen, const eval could do for type declarations</p>



<a name="183592253"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183592253" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183592253">(Dec 16 2019 at 21:23)</a>:</h4>
<p>Procedural types</p>



<a name="183592271"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183592271" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183592271">(Dec 16 2019 at 21:23)</a>:</h4>
<p>(Including their layout "obviously")</p>



<a name="183592279"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183592279" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183592279">(Dec 16 2019 at 21:23)</a>:</h4>
<p>Ok</p>



<a name="183592282"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183592282" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183592282">(Dec 16 2019 at 21:23)</a>:</h4>
<p>Bed</p>



<a name="183592284"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183592284" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183592284">(Dec 16 2019 at 21:23)</a>:</h4>
<p>Really this time</p>



<a name="183592299"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183592299" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183592299">(Dec 16 2019 at 21:23)</a>:</h4>
<p><span aria-label="sleeping" class="emoji emoji-1f634" role="img" title="sleeping">:sleeping:</span></p>



<a name="183592306"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183592306" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183592306">(Dec 16 2019 at 21:23)</a>:</h4>
<p>Yeah artifacts would be very cool. Perfect hash functions with no build script. Goodnight! Sorry for nerd sniping.</p>



<a name="183639430"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183639430" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183639430">(Dec 17 2019 at 11:28)</a>:</h4>
<p>Why do perfect hash functions need artifacts? I thought they were for use inside a program, so all you'd need to do is compute the hash table... oh and the hash function parameters. Or do we need to generate an entire function for performance reasons?</p>



<a name="183639466"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183639466" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183639466">(Dec 17 2019 at 11:29)</a>:</h4>
<p>Maybe we can just fill in associated constants and make a single generic function that is then optimized to the perfect hash function</p>



<a name="183639474"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183639474" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183639474">(Dec 17 2019 at 11:29)</a>:</h4>
<p>/me knows nothing about PHF</p>



<a name="183690418"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183690418" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183690418">(Dec 17 2019 at 20:54)</a>:</h4>
<p>(deleted)</p>



<a name="183690498"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183690498" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183690498">(Dec 17 2019 at 20:55)</a>:</h4>
<p>(deleted)</p>



<a name="183690653"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183690653" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183690653">(Dec 17 2019 at 20:56)</a>:</h4>
<p>(deleted)</p>



<a name="183691042"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183691042" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183691042">(Dec 17 2019 at 21:00)</a>:</h4>
<p>Whoops wrong thread</p>



<a name="183701144"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183701144" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183701144">(Dec 17 2019 at 23:00)</a>:</h4>
<p>There's some more advanced perfect hash function generators that vary the class of hash function based on the input. You're right that the vast majority wouldn't require artifacts. It was the first thing that popped into my head XD.</p>



<a name="183701224"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183701224" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183701224">(Dec 17 2019 at 23:00)</a>:</h4>
<p>I might actually try to implement a non-proc-macro PHF generator. Seems kind of fun!</p>



<a name="183750758"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183750758" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183750758">(Dec 18 2019 at 13:44)</a>:</h4>
<p>You can vary the hash function class by "indexing". Implement the different classes by making them traits on arrays. Each class is a different array length. Choose the algorithm via the index</p>



<a name="183884850"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183884850" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183884850">(Dec 19 2019 at 21:01)</a>:</h4>
<p><span class="user-mention" data-user-id="118594">@ecstatic-morse</span> we have a yellow light on implementing the const trait bounds RFC</p>



<a name="183884913"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183884913" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183884913">(Dec 19 2019 at 21:02)</a>:</h4>
<p>Even with the RFC still open, an unstable experiment is now permitted</p>



<a name="183885083"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183885083" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183885083">(Dec 19 2019 at 21:05)</a>:</h4>
<p>Cool! I'm happy to help implement, although it will not touch any code that I'm familiar with. Also I won't have much time until after the holidays. I'm mobile  only for the next few days XD. I'll reread the draft RFC</p>



<a name="183912698"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183912698" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183912698">(Dec 20 2019 at 06:37)</a>:</h4>
<p>yea no rush, if you want we can make an impl brainstorm meeting</p>



<a name="183912705"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183912705" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183912705">(Dec 20 2019 at 06:37)</a>:</h4>
<p>I have ideas how to get there in small steps, which should also help not requiring you to modify the entire compiler everyhwere</p>



<a name="183913746"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183913746" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183913746">(Dec 20 2019 at 07:08)</a>:</h4>
<p>Sounds good. I'll be back at full availability after Christmas on the 30th. Anytime after that would be fine for a meeting.</p>



<a name="183913949"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183913949" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183913949">(Dec 20 2019 at 07:15)</a>:</h4>
<p><span aria-label="+1" class="emoji emoji-1f44d" role="img" title="+1">:+1:</span> ok, I'm not sure how available I am between 30th and 7th</p>



<a name="183913950"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/183913950" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#183913950">(Dec 20 2019 at 07:15)</a>:</h4>
<p>we'll find sth</p>



<a name="184200028"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/184200028" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#184200028">(Dec 25 2019 at 03:22)</a>:</h4>
<p>I'm happy to review the parser changes <span aria-label="slight smile" class="emoji emoji-1f642" role="img" title="slight smile">:slight_smile:</span></p>



<a name="184700516"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/184700516" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#184700516">(Jan 03 2020 at 02:10)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@oli</span> I  implemented a <a href="https://github.com/ecstatic-morse/const-phf/blob/1a8768ea97d297b47873b8e753779e521df21356/src/lib.rs#L311" target="_blank" title="https://github.com/ecstatic-morse/const-phf/blob/1a8768ea97d297b47873b8e753779e521df21356/src/lib.rs#L311">perfect hash function generator</a> that runs entirely during const-eval. It's not very robust (it's a heuristically guided random search loosely based on gperf), but my intention was to get an idea of the most painful parts of writing complex code in a const context.</p>



<a name="184700569"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/184700569" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#184700569">(Jan 03 2020 at 02:12)</a>:</h4>
<p>(computing a PHF for the set of rust keywords takes around a second and completes just after the loop detector is triggered)</p>



<a name="184700633"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/184700633" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#184700633">(Jan 03 2020 at 02:14)</a>:</h4>
<p>The experience reaffirmed my belief that calling trait methods in const contexts is the next major roadblock. Writing code without for-loops or range-based/custom indexing is not fun.</p>



<a name="184700864"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/184700864" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#184700864">(Jan 03 2020 at 02:21)</a>:</h4>
<p>I ended up using a stack-only dynamic array a lot.  Constification of <code>ptr::write</code> and <code>MaybeUninit</code> would allow pretty much all of <a href="https://docs.rs/staticvec/0.7.7/staticvec/" target="_blank" title="https://docs.rs/staticvec/0.7.7/staticvec/">staticvec</a> to be <code>const</code> if const trait impls were implemented. I ended up rolling my own version that required <code>T: Copy</code>, needed an initial value and still had UB during initialization.</p>



<a name="184701005"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/184701005" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#184701005">(Jan 03 2020 at 02:25)</a>:</h4>
<p>The other concern I have is the lack of <code>unwrap</code>/<code>expect</code>. I think it is likely that library authors will resort to extensions like <code>fn unwrap&lt;T: Copy&gt;(x: Option&lt;T&gt;) -&gt; T</code>. As you pointed out on <a href="https://github.com/rust-lang/rust/issues/66753" target="_blank" title="https://github.com/rust-lang/rust/issues/66753">#66753</a>, I doubt there will ever be a way to implement <code>const Option::&lt;T&gt;::unwrap</code>  for all <code>T</code>without awful hacks.</p>



<a name="184701146"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/184701146" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#184701146">(Jan 03 2020 at 02:28)</a>:</h4>
<p>In fact, the need for these two methods was so acute that I am now in favor of doing a <code>mem::forget</code>-style hack to make them <code>const fn</code>  on  <code>Option</code> and <code>Result</code>. Others will no doubt disagree.</p>



<a name="184701517"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/Project%20ideas/near/184701517" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/Project.20ideas.html#184701517">(Jan 03 2020 at 02:39)</a>:</h4>
<p>The <code>?</code> operator would also be desirable, although I did not run into this quite as much, and it would require the same hacks as for <code>unwrap</code> as well as const trait impls.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>